﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhaoxi.CToolkitLesson.ViewModels
{
    public partial class MainViewModel : ObservableRecipient, IRecipient<string>
    {
        private int _value;

        public int Value
        {
            get { return _value; }
            set
            {
                SetProperty<int>(ref _value, value);


                // 加逻辑
            }
        }


        public RelayCommand ButtonCommand { get; set; }

        public MainViewModel()
        {
            ButtonCommand = new RelayCommand(DoButtonCommand);
            this.IsActive = true;
        }

        private void DoButtonCommand()
        {
            WeakReferenceMessenger.Default.Send<string>("Hello");

        }

        public void Receive(string message)
        {

        }
    }
}
